using QAssetBundle;
using UnityEngine;
using QFramework;

namespace ProjectSurvivor
{
	public partial class Bomb : GamePlayObject
	{
		private void OnTriggerEnter2D(Collider2D other)
		{
			if (other.GetComponent<CollectibleArea>())
			{
				// 消除所有敌人
				foreach (Enemy enemy in FindObjectsByType<Enemy>(FindObjectsInactive.Exclude, FindObjectsSortMode.None))
				{
					DamageSystem.CalculateDamage(Global.BombDamage.Value, enemy);
				}

				AudioKit.PlaySound(Sfx.BOMB);
				UIGamePanel.FlashScreen.Trigger();
				CameraController.Shake();
				this.DestroyGameObjGracefully();
			}
		}

		protected override Collider2D collider2d => SelfCircleCollider2D;
	}
}
